Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #36

Merged
merged 5 commits into from
Nov 19, 2024
Merged

Develop #36

merged 5 commits into from
Nov 19, 2024

Conversation

HyunWoo9930
Copy link
Collaborator

@HyunWoo9930 HyunWoo9930 commented Nov 19, 2024

  • πŸ”€ PR 제λͺ©μ˜ ν˜•μ‹μ„ 잘 μž‘μ„±ν–ˆλ‚˜μš”? e.g. [feat] PR을 λ“±λ‘ν•œλ‹€.
  • πŸ’― ν…ŒμŠ€νŠΈλŠ” 잘 ν†΅κ³Όν–ˆλ‚˜μš”?
  • πŸ—οΈ λΉŒλ“œλŠ” μ„±κ³΅ν–ˆλ‚˜μš”?
  • 🧹 λΆˆν•„μš”ν•œ μ½”λ“œλŠ” μ œκ±°ν–ˆλ‚˜μš”?
  • πŸ’­ μ΄μŠˆλŠ” λ“±λ‘ν–ˆλ‚˜μš”?
  • 🏷️ 라벨은 λ“±λ‘ν–ˆλ‚˜μš”?

μž‘μ—… λ‚΄μš©

μ£Όμ˜μ‚¬ν•­

Summary by CodeRabbit

  • μƒˆλ‘œμš΄ κΈ°λŠ₯

    • 포인트 관리 방식을 κ°œμ„ ν•˜μ—¬ 더 μ„ΈλΆ„ν™”λœ 포인트 ν• λ‹Ή κΈ°λŠ₯ μΆ”κ°€.
    • νŒ€ μΆ©μ „ 이λ ₯ 응닡을 μœ„ν•œ μƒˆλ‘œμš΄ 데이터 ꡬ쑰 TeamChargeHistoryResponse 및 StoreTeamResponseDTO μΆ”κ°€.
    • 결제 κ·Έλ£Ή 및 결제 κ·Έλ£Ή μ„ΈλΆ€ 정보λ₯Ό μ‘°νšŒν•˜λŠ” μƒˆλ‘œμš΄ API μ—”λ“œν¬μΈνŠΈ μΆ”κ°€.
  • 버그 μˆ˜μ •

    • 결제 승인 μ‹œ 였λ₯˜ 처리 κ°œμ„ , νŠΉμ • μ˜ˆμ™Έλ₯Ό 톡해 더 ꡬ체적인 였λ₯˜ 보고 κ°€λŠ₯.
  • λ¬Έμ„œν™”

    • API λ¬Έμ„œ 및 λ©”μ„œλ“œ μ„œλͺ… μ •λ¦¬λ‘œ 가독성 ν–₯상.

Copy link

coderabbitai bot commented Nov 19, 2024

Walkthrough

이 ν’€ λ¦¬ν€˜μŠ€νŠΈμ—μ„œλŠ” KakaopayService, StoreTeam, StoreController, StoreService λ“± μ—¬λŸ¬ ν΄λž˜μŠ€μ—μ„œ 포인트 관리 및 결제 κ·Έλ£Ή κ΄€λ ¨ κΈ°λŠ₯이 μˆ˜μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€. KakaopayService의 payApprove λ©”μ„œλ“œλŠ” 포인트 μ—…λ°μ΄νŠΈ 방식을 λ³€κ²½ν•˜κ³ , 였λ₯˜ 처리λ₯Ό κ°œμ„ ν–ˆμŠ΅λ‹ˆλ‹€. μƒˆλ‘œμš΄ λ ˆμ½”λ“œ 클래슀인 TeamChargeHistoryResponse와 StoreTeamResponseDTOκ°€ μΆ”κ°€λ˜μ—ˆμœΌλ©°, μ—¬λŸ¬ 리포지토리와 μ„œλΉ„μŠ€μ— νŽ˜μ΄μ§€λ„€μ΄μ…˜ κΈ°λŠ₯이 λ„μž…λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ „λ°˜μ μœΌλ‘œ 결제 처리 및 μŠ€ν† μ–΄ νŒ€ 관리 κΈ°λŠ₯이 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Changes

파일 경둜 λ³€κ²½ μš”μ•½
src/main/java/com/jangburich/domain/payment/application/KakaopayService.java payApprove λ©”μ„œλ“œμ—μ„œ 포인트 μ—…λ°μ΄νŠΈ 방식을 addPoint 및 addRemainPoint둜 λ³€κ²½ν•˜κ³ , 였λ₯˜ 처리λ₯Ό DefaultNullPointerException으둜 κ°œμ„ .
src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java TeamChargeHistoryResponse λ ˆμ½”λ“œ 클래슀 μΆ”κ°€, ν•„λ“œ: id, transactionId, paymentAmount, paymentChargeStatus.
src/main/java/com/jangburich/domain/payment/domain/repository/TeamChargeHistoryRepository.java findAllByTeam(Team team, Pageable pageable) λ©”μ„œλ“œ μΆ”κ°€, νŒ€λ³„λ‘œ νŽ˜μ΄μ§€λ„€μ΄μ…˜λœ TeamChargeHistoryResponse λ°˜ν™˜.
src/main/java/com/jangburich/domain/store/domain/StoreTeam.java remainPoint ν•„λ“œ μΆ”κ°€, updatePoint λ©”μ„œλ“œ 이름을 addPoint둜 λ³€κ²½, addRemainPoint, subRemainPoint λ©”μ„œλ“œ μΆ”κ°€.
src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java StoreTeamResponseDTO λ ˆμ½”λ“œ 클래슀 μΆ”κ°€, ν•„λ“œ: id, point, teamId, teamName, storeId.
src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈ getPaymentGroup 및 getPaymentGroupDetail μΆ”κ°€, κΈ°μ‘΄ λ©”μ„œλ“œ 이름을 Java λͺ…λͺ… κ·œμΉ™μ— 맞게 μˆ˜μ •.
src/main/java/com/jangburich/domain/store/domain/dto/response/PaymentGroupDetailResponse.java PaymentGroupDetailResponse 클래슀 μΆ”κ°€, ν•„λ“œ: teamName, point, remainPoint, teamLeaderName, teamLeaderPhoneNum, historyResponses.
src/main/java/com/jangburich/domain/store/domain/repository/StoreTeamRepository.java findAllByStore(Store store, Pageable pageable) λ©”μ„œλ“œ μΆ”κ°€, μŠ€ν† μ–΄λ³„λ‘œ νŽ˜μ΄μ§€λ„€μ΄μ…˜λœ StoreTeamResponseDTO λ°˜ν™˜.
src/main/java/com/jangburich/domain/store/domain/service/StoreService.java μƒˆλ‘œμš΄ λ©”μ„œλ“œ getPaymentGroup, getPaymentGroupDetail μΆ”κ°€, κΈ°μ‘΄ λ©”μ„œλ“œ 이름을 μˆ˜μ •ν•˜κ³  λ§€κ°œλ³€μˆ˜λ₯Ό μž¬μ •λ ¬.

Possibly related PRs

  • DevelopΒ #23: StoreTeam ν΄λž˜μŠ€μ—μ„œ updatePoint λ©”μ„œλ“œλ₯Ό addPoint둜 λ³€κ²½ν•˜κ³  addRemainPointλ₯Ό λ„μž…ν•œ λ³€κ²½ 사항은 KakaopayService ν΄λž˜μŠ€μ—μ„œ μœ μ‚¬ν•œ λ©”μ„œλ“œ 이름이 μ—…λ°μ΄νŠΈλœ 것과 μ§μ ‘μ μœΌλ‘œ 관련이 μžˆμŠ΅λ‹ˆλ‹€.

🐰 λ³€ν™”μ˜ λ°”λžŒμ΄ λΆˆμ–΄μ™€,
ν¬μΈνŠΈκ°€ μΆ€μΆ”κ³ , νŒ€μ΄ ν•˜λ‚˜λ‘œ,
μƒˆλ‘œμš΄ 길을 μ—΄μ–΄μ£Όλ„€,
결제의 기쁨, ν•¨κ»˜ λ‚˜λˆ„κ³ ,
μŠ€ν† μ–΄μ˜ κΏˆμ„ μ΄λ£¨μ–΄κ°€μš”!
πŸ₯•βœ¨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 12

🧹 Outside diff range and nitpick comments (11)
src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java (2)

3-3: μ‚¬μš©ν•˜μ§€ μ•ŠλŠ” import 문이 μžˆμŠ΅λ‹ˆλ‹€.

Team 클래슀λ₯Ό import ν•˜κ³  μžˆμœΌλ‚˜ μ½”λ“œ λ‚΄μ—μ„œ μ‚¬μš©λ˜μ§€ μ•Šκ³  μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•΄μ£Όμ„Έμš”:

-import com.jangburich.domain.team.domain.Team;

17-24: @QueryProjection μƒμ„±μžμ— μœ νš¨μ„± 검증이 ν•„μš”ν•©λ‹ˆλ‹€.

λ°μ΄ν„°λ² μ΄μŠ€μ—μ„œ μ‘°νšŒν•œ κ²°κ³Όλ₯Ό 맀핑할 λ•Œ null μ²΄ν¬λ‚˜ μœ νš¨μ„± 검증이 μ—†μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 κ°œμ„ ν•΄λ³΄μ„Έμš”:

 @QueryProjection
 public StoreTeamResponseDTO(Long id, Integer point, Long teamId, String teamName, Long storeId) {
+    if (id == null || teamId == null || storeId == null) {
+        throw new IllegalArgumentException("ν•„μˆ˜ ID 값이 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€");
+    }
+    if (teamName == null || teamName.trim().isEmpty()) {
+        throw new IllegalArgumentException("νŒ€ 이름은 ν•„μˆ˜μž…λ‹ˆλ‹€");
+    }
     this.id = id;
     this.point = point;
     this.teamId = teamId;
     this.teamName = teamName;
     this.storeId = storeId;
 }
src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java (2)

7-13: λ ˆμ½”λ“œ 클래슀 섀계가 잘 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

λΆˆλ³€ 데이터λ₯Ό μœ„ν•œ λ ˆμ½”λ“œ μ‚¬μš©μ΄ μ μ ˆν•˜λ©°, ν•„λ“œλ“€μ˜ λͺ…λͺ…이 λͺ…ν™•ν•©λ‹ˆλ‹€. ν•˜μ§€λ§Œ ν•„λ“œμ— λŒ€ν•œ μœ νš¨μ„± 검증이 μ—†μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같은 검증 둜직 μΆ”κ°€λ₯Ό κ³ λ €ν•΄λ³΄μ„Έμš”:

@Builder
public record TeamChargeHistoryResponse(
    Long id,
    String transactionId,
    Integer paymentAmount,
    PaymentChargeStatus paymentChargeStatus
) {
+    public TeamChargeHistoryResponse {
+        if (paymentAmount != null && paymentAmount < 0) {
+            throw new IllegalArgumentException("결제 κΈˆμ•‘μ€ 음수일 수 μ—†μŠ΅λ‹ˆλ‹€.");
+        }
+        if (transactionId != null && transactionId.isBlank()) {
+            throw new IllegalArgumentException("거래 IDλŠ” λΉ„μ–΄μžˆμ„ 수 μ—†μŠ΅λ‹ˆλ‹€.");
+        }
+    }

14-21: QueryProjection μƒμ„±μžκ°€ 적절히 κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

QueryDSL ν”„λ‘œμ μ…˜μ„ μœ„ν•œ μƒμ„±μžκ°€ 잘 κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. ν•˜μ§€λ§Œ Javadoc λ¬Έμ„œν™”κ°€ λˆ„λ½λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 Javadoc을 μΆ”κ°€ν•˜λŠ” 것을 μΆ”μ²œλ“œλ¦½λ‹ˆλ‹€:

+    /**
+     * QueryDSL ν”„λ‘œμ μ…˜μ„ μœ„ν•œ μƒμ„±μžμž…λ‹ˆλ‹€.
+     *
+     * @param id νŒ€ μΆ©μ „ λ‚΄μ—­ ID
+     * @param transactionId 거래 ID
+     * @param paymentAmount 결제 κΈˆμ•‘
+     * @param paymentChargeStatus 결제 μƒνƒœ
+     */
    @QueryProjection
    public TeamChargeHistoryResponse(Long id, String transactionId, Integer paymentAmount,
        PaymentChargeStatus paymentChargeStatus) {
src/main/java/com/jangburich/domain/store/domain/dto/response/PaymentGroupDetailResponse.java (1)

15-15: 클래슀 λ¬Έμ„œν™”κ°€ ν•„μš”ν•©λ‹ˆλ‹€

클래슀의 λͺ©μ κ³Ό μ‚¬μš©λ²•μ— λŒ€ν•œ λ¬Έμ„œν™”κ°€ μ—†μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 Javadoc을 μΆ”κ°€ν•˜λŠ” 것을 μΆ”μ²œλ“œλ¦½λ‹ˆλ‹€:

+/**
+ * 결제 그룹의 상세 정보λ₯Ό λ‹΄λŠ” 응닡 DTOμž…λ‹ˆλ‹€.
+ * <p>
+ * 이 ν΄λž˜μŠ€λŠ” νŒ€ 정보, 포인트 정보, νŒ€μž₯ 정보 및 결제 내역을 ν¬ν•¨ν•©λ‹ˆλ‹€.
+ * λͺ¨λ“  ν•„λ“œλŠ” λΆˆλ³€μ΄λ©°, 객체 생성은 {@link #create} νŒ©ν† λ¦¬ λ©”μ„œλ“œλ₯Ό ν†΅ν•΄μ„œλ§Œ κ°€λŠ₯ν•©λ‹ˆλ‹€.
+ */
 public class PaymentGroupDetailResponse {
src/main/java/com/jangburich/domain/store/domain/StoreTeam.java (1)

40-41: 포인트 ν•„λ“œμ— λŒ€ν•œ λ¬Έμ„œν™”κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

remainPoint ν•„λ“œμ˜ μš©λ„μ™€ point ν•„λ“œμ™€μ˜ 차이점을 λͺ…ν™•νžˆ ν•˜κΈ° μœ„ν•΄ Javadoc λ¬Έμ„œν™”λ₯Ό μΆ”κ°€ν•΄ μ£Όμ„Έμš”.

+/**
+ * μ‚¬μš© κ°€λŠ₯ν•œ μž”μ—¬ 포인트λ₯Ό λ‚˜νƒ€λƒ…λ‹ˆλ‹€.
+ * pointλŠ” 총 적립된 포인트λ₯Ό, remainPointλŠ” μ‹€μ œ μ‚¬μš© κ°€λŠ₯ν•œ 포인트λ₯Ό μΆ”μ ν•©λ‹ˆλ‹€.
+ */
 @Column(name = "remain_point")
 private Integer remainPoint;
src/main/java/com/jangburich/domain/payment/application/KakaopayService.java (1)

Line range hint 126-127: μ˜ˆμ™Έ 처리 κ°œμ„  ν•„μš”

TeamChargeHistoryλ₯Ό 찾지 λͺ»ν–ˆμ„ λ•Œ λ°œμƒν•˜λŠ” raw NullPointerException은 μ μ ˆν•œ μ»€μŠ€ν…€ μ˜ˆμ™Έλ‘œ λŒ€μ²΄λ˜μ–΄μ•Ό ν•©λ‹ˆλ‹€. μ΄λŠ” λ‹€μŒκ³Ό 같은 이유둜 μ€‘μš”ν•©λ‹ˆλ‹€:

  1. λͺ…ν™•ν•œ μ—λŸ¬ λ©”μ‹œμ§€ 제곡
  2. μΌκ΄€λœ μ˜ˆμ™Έ 처리 νŒ¨ν„΄ μœ μ§€
  3. 디버깅 μš©μ΄μ„± ν–₯상

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆν•©λ‹ˆλ‹€:

- .orElseThrow(() -> new NullPointerException());
+ .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.TEAM_CHARGE_HISTORY_NOT_FOUND));

ErrorCode에 μ μ ˆν•œ μƒμˆ˜λ₯Ό μΆ”κ°€ν•΄μ£Όμ„Έμš”:

TEAM_CHARGE_HISTORY_NOT_FOUND("결제 내역을 찾을 수 μ—†μŠ΅λ‹ˆλ‹€.")
src/main/java/com/jangburich/domain/store/domain/service/StoreService.java (4)

156-167: userId λŒ€μ‹  Authentication 객체 μ‚¬μš©μ„ ꢌμž₯λ“œλ¦½λ‹ˆλ‹€.

getPaymentGroup λ©”μ„œλ“œμ—μ„œλŠ” String userIdλ₯Ό νŒŒλΌλ―Έν„°λ‘œ λ°›κ³  μžˆμŠ΅λ‹ˆλ‹€. λ‹€λ₯Έ λ©”μ„œλ“œλ“€(searchByCategory, searchStores)μ—μ„œλŠ” Authentication 객체λ₯Ό λ°›μ•„ AuthenticationParserλ₯Ό 톡해 userIdλ₯Ό μΆ”μΆœν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. 일관성을 μœ„ν•΄ Authentication 객체λ₯Ό λ°›μ•„ μ²˜λ¦¬ν•˜λŠ” 것을 μΆ”μ²œν•©λ‹ˆλ‹€.


190-213: 쀑볡 μ½”λ“œμ˜ λ¦¬νŒ©ν† λ§μ„ μ œμ•ˆν•©λ‹ˆλ‹€.

getPaymentGroupDetail λ©”μ„œλ“œμ—μ„œ User, Owner, Storeλ₯Ό μ‘°νšŒν•˜λŠ” 둜직이 μ•žμ„œ κ΅¬ν˜„λœ λ©”μ„œλ“œλ“€κ³Ό μ€‘λ³΅λ©λ‹ˆλ‹€. ν•΄λ‹Ή 뢀뢄을 λ³„λ„μ˜ 곡톡 λ©”μ„œλ“œλ‘œ μΆ”μΆœν•˜μ—¬ μ½”λ“œ 쀑볡을 쀄이고 μœ μ§€λ³΄μˆ˜μ„±μ„ 높일 수 μžˆμŠ΅λ‹ˆλ‹€.


209-210: λ³€μˆ˜ λͺ…칭을 더 λͺ…ν™•ν•˜κ²Œ λ³€κ²½ν•΄μ£Όμ„Έμš”.

chargeHistoryRepositoryAllByTeam λ³€μˆ˜λͺ…은 λ‹€μ†Œ κΈΈκ³  의미 전달이 μ–΄λ €μšΈ 수 μžˆμŠ΅λ‹ˆλ‹€. teamChargeHistories와 같이 보닀 직관적인 μ΄λ¦„μœΌλ‘œ λ³€κ²½ν•˜λ©΄ μ½”λ“œλ₯Ό μ΄ν•΄ν•˜κΈ° μ‰½μŠ΅λ‹ˆλ‹€.


νŠΈλžœμž­μ…˜ μ–΄λ…Έν…Œμ΄μ…˜ 적용이 ν•„μš”ν•œ λ©”μ„œλ“œκ°€ μžˆμŠ΅λ‹ˆλ‹€.

데이터 λ³€κ²½ μž‘μ—…μ„ λΆ„μ„ν•œ κ²°κ³Ό, λ‹€μŒκ³Ό 같이 νŠΈλžœμž­μ…˜ μ–΄λ…Έν…Œμ΄μ…˜μ„ μˆ˜μ •ν•΄μ•Ό ν•©λ‹ˆλ‹€:

  • createAdditionalInfo λ©”μ„œλ“œ: μ—¬λŸ¬ set μž‘μ—…κ³Ό save μž‘μ—…μ΄ ν¬ν•¨λ˜μ–΄ μžˆμœΌλ―€λ‘œ @Transactional μ–΄λ…Έν…Œμ΄μ…˜μ΄ ν•„μš”ν•©λ‹ˆλ‹€.
  • createStore, updateStore λ©”μ„œλ“œ: ν˜„μž¬ μ˜¬λ°”λ₯΄κ²Œ @Transactional이 μ μš©λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.
  • λ‚˜λ¨Έμ§€ 쑰회 λ©”μ„œλ“œλ“€(getStoreInfo, getPaymentGroup, searchByCategory, searchStores, getPaymentGroupDetail): 읽기 μ „μš© νŠΈλžœμž­μ…˜μœΌλ‘œ μ²˜λ¦¬ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. @Transactional(readOnly = true) μ μš©μ„ ꢌμž₯ν•©λ‹ˆλ‹€.
πŸ”— Analysis chain

Line range hint 50-213: νŠΈλžœμž­μ…˜ λ²”μœ„λ₯Ό μž¬κ²€ν† ν•΄μ£Όμ„Έμš”.

일뢀 λ©”μ„œλ“œμ—λ§Œ @Transactional μ–΄λ…Έν…Œμ΄μ…˜μ΄ μ μš©λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. 데이터 변경이 μ—†λŠ” 쑰회 λ©”μ„œλ“œμ—μ„œλ„ ν•„μš”ν•œ 경우 νŠΈλžœμž­μ…˜μ„ μ μš©ν•˜κ±°λ‚˜, λΆˆν•„μš”ν•œ κ³³μ—μ„œλŠ” μ œκ±°ν•˜μ—¬ νŠΈλžœμž­μ…˜ 경계λ₯Ό λͺ…ν™•νžˆ μ„€μ •ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•˜μ—¬ 각 λ©”μ„œλ“œμ˜ νŠΈλžœμž­μ…˜ μ–΄λ…Έν…Œμ΄μ…˜ 적용 μ—¬λΆ€λ₯Ό 확인할 수 μžˆμŠ΅λ‹ˆλ‹€:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: `@Transactional` μ–΄λ…Έν…Œμ΄μ…˜μ΄ μ˜¬λ°”λ₯΄κ²Œ μ μš©λ˜μ—ˆλŠ”μ§€ ν™•μΈν•©λ‹ˆλ‹€.

# Test: λ©”μ„œλ“œλ³„λ‘œ `@Transactional` μ‚¬μš© μ—¬λΆ€λ₯Ό ν™•μΈν•©λ‹ˆλ‹€.
ast-grep --pattern $'@Transactional\n$_\npublic $_($_) {\n$$$}' src/main/java/com/jangburich/domain/store/domain/service/StoreService.java

Length of output: 136


Script:

#!/bin/bash
# Let's try a different approach to check the methods and their transaction annotations

# First, let's see all public methods in the service
echo "=== All public methods ==="
rg "public.*\{" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java

# Then, let's check which ones have @Transactional
echo -e "\n=== Methods with @Transactional ==="
rg -B1 "public.*\{" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java | grep -B1 "public"

# Let's also check if there are any repository save/update operations
echo -e "\n=== Repository operations ==="
rg "repository\.(save|update|delete)" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java

Length of output: 1602


Script:

#!/bin/bash
# Let's check for repository operations with a broader pattern and look for data modifications
echo "=== Repository save operations ==="
rg "storeRepository\.save" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java -B1 -A1

echo -e "\n=== Store modifications ==="
rg "store\.set" src/main/java/com/jangburich/domain/store/domain/service/StoreService.java -B1 -A1

# Let's also check for any other repository methods that might modify data
echo -e "\n=== All repository method calls ==="
rg "Repository\." src/main/java/com/jangburich/domain/store/domain/service/StoreService.java

Length of output: 4569

πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between ac83537 and 85feb74.

πŸ“’ Files selected for processing (9)
  • src/main/java/com/jangburich/domain/payment/application/KakaopayService.java (1 hunks)
  • src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java (1 hunks)
  • src/main/java/com/jangburich/domain/payment/domain/repository/TeamChargeHistoryRepository.java (1 hunks)
  • src/main/java/com/jangburich/domain/store/domain/StoreTeam.java (1 hunks)
  • src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java (1 hunks)
  • src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java (3 hunks)
  • src/main/java/com/jangburich/domain/store/domain/dto/response/PaymentGroupDetailResponse.java (1 hunks)
  • src/main/java/com/jangburich/domain/store/domain/repository/StoreTeamRepository.java (1 hunks)
  • src/main/java/com/jangburich/domain/store/domain/service/StoreService.java (4 hunks)
πŸ”‡ Additional comments (9)
src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java (2)

1-6: νŒ¨ν‚€μ§€ ꡬ쑰와 μž„ν¬νŠΈκ°€ μ μ ˆν•©λ‹ˆλ‹€.

ν•„μš”ν•œ μ–΄λ…Έν…Œμ΄μ…˜λ“€λ§Œ μž„ν¬νŠΈλ˜μ–΄ μžˆμ–΄ κΉ”λ”ν•©λ‹ˆλ‹€.


1-22: PaymentChargeStatus μ—΄κ±°ν˜• μ˜μ‘΄μ„± 확인이 ν•„μš”ν•©λ‹ˆλ‹€.

PaymentChargeStatus μ—΄κ±°ν˜•μ΄ μ˜¬λ°”λ₯΄κ²Œ μ •μ˜λ˜μ–΄ μžˆλŠ”μ§€ 확인이 ν•„μš”ν•©λ‹ˆλ‹€.

βœ… Verification successful

The shell script results show that PaymentChargeStatus is properly defined as an enum in src/main/java/com/jangburich/domain/payment/domain/PaymentChargeStatus.java with valid states (PENDING, COMPLETED, CANCELLED, REFUNDED). The enum is correctly used in TeamChargeHistory, TeamChargeHistoryResponse, and KakaopayService. Let me provide the final response in Korean:

PaymentChargeStatus μ—΄κ±°ν˜•μ΄ μ˜¬λ°”λ₯΄κ²Œ μ •μ˜λ˜μ–΄ 있고 μ μ ˆν•˜κ²Œ μ‚¬μš©λ˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

PaymentChargeStatus μ—΄κ±°ν˜•μ€ λ‹€μŒκ³Ό 같이 결제 μƒνƒœλ₯Ό λͺ…ν™•ν•˜κ²Œ μ •μ˜ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€:

  • PENDING (λŒ€κΈ°)
  • COMPLETED (μ™„λ£Œ)
  • CANCELLED (μ·¨μ†Œ)
  • REFUNDED (ν™˜λΆˆ)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# PaymentChargeStatus μ—΄κ±°ν˜• μ •μ˜λ₯Ό 확인
ast-grep --pattern 'enum PaymentChargeStatus {
  $$$
}'

# PaymentChargeStatus μ‚¬μš©μ²˜ 확인
rg -A 5 'PaymentChargeStatus'

Length of output: 5742

src/main/java/com/jangburich/domain/store/domain/repository/StoreTeamRepository.java (1)

5-6: νŽ˜μ΄μ§€λ„€μ΄μ…˜ κ΅¬ν˜„μ΄ 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Spring Data JPA의 νŽ˜μ΄μ§€λ„€μ΄μ…˜ κΈ°λŠ₯을 ν™œμš©ν•œ κ΅¬ν˜„μ΄ 잘 λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€.

Also applies to: 16-16

src/main/java/com/jangburich/domain/payment/domain/repository/TeamChargeHistoryRepository.java (2)

4-10: ν•„μš”ν•œ import 문이 잘 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

νŽ˜μ΄μ§€λ„€μ΄μ…˜ κ΅¬ν˜„μ„ μœ„ν•œ Spring Data κ΄€λ ¨ ν΄λž˜μŠ€λ“€κ³Ό 도메인 ν΄λž˜μŠ€λ“€μ΄ 적절히 import λ˜μ—ˆμŠ΅λ‹ˆλ‹€.


18-18: 엔티티와 응닡 DTO κ°„μ˜ 맀핑 검증이 ν•„μš”ν•©λ‹ˆλ‹€.

findAllByTeam λ©”μ„œλ“œκ°€ TeamChargeHistory μ—”ν‹°ν‹° λŒ€μ‹  TeamChargeHistoryResponseλ₯Ό 직접 λ°˜ν™˜ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” 일반적인 νŒ¨ν„΄μ€ μ•„λ‹™λ‹ˆλ‹€.

λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•˜μ—¬ 맀핑 κ΅¬ν˜„μ„ ν™•μΈν•˜κ² μŠ΅λ‹ˆλ‹€:

μ œμ•ˆμ‚¬ν•­:

  1. μ„œλΉ„μŠ€ κ³„μΈ΅μ—μ„œ μ—”ν‹°ν‹°λ₯Ό DTO둜 λ³€ν™˜ν•˜λŠ” 것이 더 쒋은 방법일 수 μžˆμŠ΅λ‹ˆλ‹€.
  2. λ˜λŠ” @Query μ–΄λ…Έν…Œμ΄μ…˜μ„ μ‚¬μš©ν•˜μ—¬ λͺ…μ‹œμ μΈ 맀핑을 μ •μ˜ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
βœ… Verification successful

QueryDSL을 μ‚¬μš©ν•œ μ μ ˆν•œ 맀핑이 κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

TeamChargeHistoryResponse λ ˆμ½”λ“œμ— @QueryProjection μ–΄λ…Έν…Œμ΄μ…˜μ΄ μ μš©λ˜μ–΄ μžˆμ–΄ QueryDSL을 ν†΅ν•œ μ—”ν‹°ν‹°-DTO 맀핑이 μ˜¬λ°”λ₯΄κ²Œ κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μ„±λŠ₯κ³Ό μœ μ§€λ³΄μˆ˜μ„± μΈ‘λ©΄μ—μ„œ 쒋은 μ ‘κ·Ό λ°©μ‹μž…λ‹ˆλ‹€.

  • @QueryProjection을 μ‚¬μš©ν•˜μ—¬ μ—”ν‹°ν‹°μ—μ„œ DTO둜의 직접 맀핑이 κ°€λŠ₯
  • ν•„μš”ν•œ ν•„λ“œλ§Œ μ„ νƒμ μœΌλ‘œ μ‘°νšŒν•  수 μžˆμ–΄ μ„±λŠ₯상 이점 쑴재
  • 컴파일 μ‹œμ μ— νƒ€μž… μ•ˆμ „μ„± 보μž₯
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# TeamChargeHistoryResponse ν΄λž˜μŠ€μ—μ„œ 맀핑 κ΄€λ ¨ μ½”λ“œ 확인
ast-grep --pattern 'record TeamChargeHistoryResponse($$$) {
  $$$
}'

# 맀핑 κ΅¬ν˜„μ΄ μžˆλŠ”μ§€ 확인
rg -A 5 "TeamChargeHistory.*TeamChargeHistoryResponse"

Length of output: 127


Script:

#!/bin/bash
# 1. TeamChargeHistoryResponse 클래슀 파일 찾기
fd TeamChargeHistoryResponse

# 2. TeamChargeHistory μ—”ν‹°ν‹° 클래슀 μ°ΎκΈ°
fd TeamChargeHistory

# 3. Repository ν΄λž˜μŠ€μ—μ„œ κ΄€λ ¨ μΏΌλ¦¬λ‚˜ 맀핑 확인
rg -A 5 "@Query.*TeamChargeHistoryResponse"

# 4. ν”„λ‘œμ νŠΈ λ‚΄μ˜ λͺ¨λ“  TeamChargeHistoryResponse μ‚¬μš© 검색
rg "TeamChargeHistoryResponse"

Length of output: 1914


Script:

#!/bin/bash
# TeamChargeHistoryResponse λ ˆμ½”λ“œμ˜ κ΅¬ν˜„ 확인
cat src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistoryResponse.java

# TeamChargeHistory μ—”ν‹°ν‹° κ΅¬ν˜„ 확인
cat src/main/java/com/jangburich/domain/payment/domain/TeamChargeHistory.java

# Repository κ΅¬ν˜„μ²΄ 확인
fd -e java "TeamChargeHistoryRepositoryImpl"

Length of output: 2566

src/main/java/com/jangburich/domain/store/domain/StoreTeam.java (1)

60-60: 초기 remainPoint 섀정이 μ μ ˆν•΄ λ³΄μž…λ‹ˆλ‹€.

μƒˆλ‘œμš΄ StoreTeam 생성 μ‹œ remainPointλ₯Ό point와 λ™μΌν•˜κ²Œ μ„€μ •ν•˜λŠ” 것이 λ…Όλ¦¬μ μž…λ‹ˆλ‹€.

src/main/java/com/jangburich/domain/store/domain/controller/StoreController.java (2)

17-30: μƒˆλ‘œμš΄ μ˜μ‘΄μ„± μΆ”κ°€κ°€ μ μ ˆν•©λ‹ˆλ‹€!

결제 κ·Έλ£Ή κΈ°λŠ₯ κ΅¬ν˜„μ„ μœ„ν•œ μƒˆλ‘œμš΄ DTO ν΄λž˜μŠ€λ“€κ³Ό 인증 νŒŒμ„œ μœ ν‹Έλ¦¬ν‹°μ˜ μΆ”κ°€κ°€ 잘 λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€.


103-118: 결제 κ·Έλ£Ή κ΄€λ ¨ μ—”λ“œν¬μΈνŠΈ κ΅¬ν˜„μ΄ 잘 λ˜μ—ˆμŠ΅λ‹ˆλ‹€!

  • Swagger λ¬Έμ„œν™”κ°€ 잘 λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€.
  • AuthenticationParserλ₯Ό ν™œμš©ν•œ 인증 μ²˜λ¦¬κ°€ κΉ”λ”ν•©λ‹ˆλ‹€.
  • νŽ˜μ΄μ§€λ„€μ΄μ…˜μ΄ μ μ ˆν•˜κ²Œ κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.
src/main/java/com/jangburich/domain/payment/application/KakaopayService.java (1)

133-134: ⚠️ Potential issue

포인트 μΆ”κ°€ 둜직 κ²€ν†  ν•„μš”

λ™μΌν•œ κΈˆμ•‘(paymentAmount)이 addPoint와 addRemainPoint 두 λ©”μ„œλ“œμ— λͺ¨λ‘ μ „λ‹¬λ˜κ³  μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μ˜λ„λœ λ™μž‘μΈμ§€ 확인이 ν•„μš”ν•©λ‹ˆλ‹€.

  1. 두 λ©”μ„œλ“œμ˜ 차이점과 각각의 μš©λ„μ— λŒ€ν•œ λ¬Έμ„œν™”κ°€ ν•„μš”ν•©λ‹ˆλ‹€.
  2. λ™μΌν•œ κΈˆμ•‘μ„ 두 번 μΆ”κ°€ν•˜λŠ” 것이 λ§žλŠ”μ§€ 검증이 ν•„μš”ν•©λ‹ˆλ‹€.
βœ… Verification successful

포인트 관리 둜직이 μ˜λ„λœ μ„€κ³„μž„μ„ 확인

StoreTeam μ—”ν‹°ν‹°μ˜ κ΅¬ν˜„μ„ ν™•μΈν•œ κ²°κ³Ό, point와 remainPointλŠ” μ„œλ‘œ λ‹€λ₯Έ λͺ©μ μ„ 가진 λ³„λ„μ˜ ν•„λ“œμž…λ‹ˆλ‹€:

  • point: λˆ„μ  μΆ©μ „ 포인트λ₯Ό 관리
  • remainPoint: μ‹€μ œ μ‚¬μš© κ°€λŠ₯ν•œ μž”μ—¬ 포인트λ₯Ό 관리

λ”°λΌμ„œ μΆ©μ „ μ‹œ 두 ν•„λ“œλ₯Ό λͺ¨λ‘ μ¦κ°€μ‹œν‚€λŠ” ν˜„μž¬ κ΅¬ν˜„μ€ μ˜¬λ°”λ₯Έ μ„€κ³„μž…λ‹ˆλ‹€. λ‹€λ§Œ μ•„λž˜ κ°œμ„ μ‚¬ν•­μ„ μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

  • 각 ν•„λ“œμ™€ λ©”μ„œλ“œμ˜ μš©λ„λ₯Ό λͺ…ν™•νžˆ ν•˜λŠ” 주석 μΆ”κ°€ ν•„μš”
  • λ©”μ„œλ“œλͺ…을 더 λͺ…ν™•ν•˜κ²Œ λ³€κ²½ κ²€ν†  (예: addPoint β†’ addTotalPoint)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# StoreTeam ν΄λž˜μŠ€μ—μ„œ addPoint와 addRemainPoint λ©”μ„œλ“œμ˜ κ΅¬ν˜„μ„ 확인

ast-grep --pattern $'class StoreTeam {
  $$$
  addPoint($_) {
    $$$
  }
  $$$
  addRemainPoint($_) {
    $$$
  }
  $$$
}'

Length of output: 124


Script:

#!/bin/bash
# Search for StoreTeam class implementation
rg -U "class StoreTeam[\s\S]*?}" -A 10

# Search for addPoint and addRemainPoint method calls or references
rg "addPoint|addRemainPoint" -A 2 -B 2

Length of output: 4418

Comment on lines +9 to +15
public record StoreTeamResponseDTO(
Long id,
Integer point,
Long teamId,
String teamName,
Long storeId

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

ν•„λ“œ νƒ€μž…κ³Ό μœ νš¨μ„± 검증을 κ°œμ„ ν•΄μ£Όμ„Έμš”.

  1. Long νƒ€μž…μ˜ ID ν•„λ“œλ“€μ€ null이 될 수 μžˆμœΌλ―€λ‘œ μœ νš¨μ„± 검증이 ν•„μš”ν•©λ‹ˆλ‹€.
  2. point ν•„λ“œλŠ” κΈˆμ•‘μ„ λ‹€λ£¨λŠ” κ²ƒμœΌλ‘œ λ³΄μ΄λŠ”λ°, Integer λŒ€μ‹  BigDecimalμ΄λ‚˜ Money νƒ€μž… μ‚¬μš©μ„ κ³ λ €ν•΄λ³΄μ„Έμš”.
  3. ν•„λ“œμ— λŒ€ν•œ μ„€λͺ… 주석이 μ—†μ–΄ 각 ν•„λ“œμ˜ μš©λ„λ₯Ό νŒŒμ•…ν•˜κΈ° μ–΄λ ΅μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 κ°œμ„ ν•΄λ³΄μ„Έμš”:

+import jakarta.validation.constraints.NotNull;
+import java.math.BigDecimal;

 @Builder
 public record StoreTeamResponseDTO(
+    @NotNull(message = "idλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
     Long id,
-    Integer point,
+    BigDecimal point,
+    @NotNull(message = "teamIdλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
     Long teamId,
+    @NotNull(message = "teamName은 ν•„μˆ˜μž…λ‹ˆλ‹€")
     String teamName,
+    @NotNull(message = "storeIdλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
     Long storeId
 )
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public record StoreTeamResponseDTO(
Long id,
Integer point,
Long teamId,
String teamName,
Long storeId
import jakarta.validation.constraints.NotNull;
import java.math.BigDecimal;
public record StoreTeamResponseDTO(
@NotNull(message = "idλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
Long id,
BigDecimal point,
@NotNull(message = "teamIdλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
Long teamId,
@NotNull(message = "teamName은 ν•„μˆ˜μž…λ‹ˆλ‹€")
String teamName,
@NotNull(message = "storeIdλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
Long storeId


public interface StoreTeamRepository extends JpaRepository<StoreTeam, Long> {
Optional<StoreTeam> findByStoreIdAndTeamId(Long store_id, Long team_id);

Page<StoreTeamResponseDTO> findAllByStore(Store store, Pageable pageable);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codebase verification

DTO 맀핑 κ΅¬ν˜„μ΄ λˆ„λ½λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

StoreTeamRepositoryμ—μ„œ Page<StoreTeamResponseDTO>λ₯Ό λ°˜ν™˜ν•˜λŠ” λ©”μ„œλ“œκ°€ μ„ μ–Έλ˜μ–΄ μžˆμ§€λ§Œ, μ‹€μ œ 맀핑 κ΅¬ν˜„μ΄ ν™•μΈλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. λ‹€μŒ μž‘μ—…μ΄ ν•„μš”ν•©λ‹ˆλ‹€:

  • StoreTeamRepositoryImpl 클래슀λ₯Ό μƒμ„±ν•˜μ—¬ QueryDSL λ˜λŠ” JPQL을 μ‚¬μš©ν•œ 맀핑 κ΅¬ν˜„μ΄ ν•„μš”ν•©λ‹ˆλ‹€.
  • λ˜λŠ” @Query μ–΄λ…Έν…Œμ΄μ…˜μ„ μ‚¬μš©ν•˜μ—¬ μΈν„°νŽ˜μ΄μŠ€μ— 직접 맀핑 쿼리λ₯Ό μž‘μ„±ν•΄μ•Ό ν•©λ‹ˆλ‹€.

맀핑 μ‹œ λ‹€μŒ ν•„λ“œλ“€μ΄ μ˜¬λ°”λ₯΄κ²Œ λ³€ν™˜λ˜μ–΄μ•Ό ν•©λ‹ˆλ‹€:

  • StoreTeam의 id β†’ StoreTeamResponseDTO의 id
  • StoreTeam의 point β†’ StoreTeamResponseDTO의 point
  • Team의 id β†’ StoreTeamResponseDTO의 teamId
  • Team의 name β†’ StoreTeamResponseDTO의 teamName
  • Store의 id β†’ StoreTeamResponseDTO의 storeId
πŸ”— Analysis chain

DTO λ³€ν™˜ κ΅¬ν˜„ 확인이 ν•„μš”ν•©λ‹ˆλ‹€.

StoreTeamResponseDTO둜의 μžλ™ 맀핑이 μ œλŒ€λ‘œ λ™μž‘ν•˜λŠ”μ§€ 확인이 ν•„μš”ν•©λ‹ˆλ‹€.

λ‹€μŒ 슀크립트둜 DTO 맀핑 κ΅¬ν˜„μ„ ν™•μΈν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€:


Let me gather more information about the DTO mapping implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: DTO 맀핑 κ΅¬ν˜„ 확인

# StoreTeamResponseDTO 클래슀의 ꡬ쑰 확인
ast-grep --pattern 'record StoreTeamResponseDTO($$$)'

# 맀핑 κ΄€λ ¨ μ„€μ •μ΄λ‚˜ κ΅¬ν˜„ 확인
rg -g '*.java' -A 5 'StoreTeamResponseDTO'

Length of output: 5626


Script:

#!/bin/bash
# StoreTeam 엔티티와 맀핑 κ΅¬ν˜„ 확인
rg -g '*.java' -A 10 'class StoreTeam'

# StoreTeamRepository κ΅¬ν˜„μ²΄ 확인
fd -e java StoreTeamRepository

Length of output: 1116


Script:

#!/bin/bash
# StoreTeamRepository κ΅¬ν˜„μ²΄ 확인 (QueryDSL λ˜λŠ” JPQL κ΅¬ν˜„)
rg -g '*.java' -A 15 'class StoreTeamRepositoryImpl'

# Team μ—”ν‹°ν‹° ꡬ쑰 확인
rg -g '*.java' -A 10 'class Team'

# StoreTeam μ—”ν‹°ν‹°μ˜ λ‚˜λ¨Έμ§€ ν•„λ“œ 확인
rg -g '*.java' -C 20 'class StoreTeam'

Length of output: 9799

Comment on lines +12 to +14
@Getter
@Setter
@RequiredArgsConstructor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

DTO의 λΆˆλ³€μ„± κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€

응닡 DTOλŠ” λΆˆλ³€ 객체둜 μ„€κ³„ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. ν˜„μž¬ κ΅¬μ‘°μ—μ„œλŠ” μ™ΈλΆ€μ—μ„œ setterλ₯Ό 톡해 값을 λ³€κ²½ν•  수 μžˆμ–΄ μ•ˆμ „ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•˜λŠ” 것을 μΆ”μ²œλ“œλ¦½λ‹ˆλ‹€:

 @Getter
-@Setter
-@RequiredArgsConstructor
+@AllArgsConstructor(access = AccessLevel.PRIVATE)
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Getter
@Setter
@RequiredArgsConstructor
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@RequiredArgsConstructor

Comment on lines +23 to +33
public static PaymentGroupDetailResponse create(String teamName, Integer point, Integer remainPoint,
User teamLeader, Page<TeamChargeHistoryResponse> historyResponses) {
PaymentGroupDetailResponse paymentGroupDetailResponse = new PaymentGroupDetailResponse();
paymentGroupDetailResponse.setTeamName(teamName);
paymentGroupDetailResponse.setPoint(point);
paymentGroupDetailResponse.setRemainPoint(remainPoint);
paymentGroupDetailResponse.setTeamLeaderName(teamLeader.getNickname());
paymentGroupDetailResponse.setTeamLeaderPhoneNum(teamLeader.getPhoneNumber());
paymentGroupDetailResponse.setHistoryResponses(historyResponses);
return paymentGroupDetailResponse;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

νŒ©ν† λ¦¬ λ©”μ„œλ“œμ˜ μ•ˆμ „μ„± κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€

μž…λ ₯ νŒŒλΌλ―Έν„°μ— λŒ€ν•œ μœ νš¨μ„± 검증이 μ—†μœΌλ©°, User 객체가 null일 경우 NullPointerException이 λ°œμƒν•  수 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•˜λŠ” 것을 μΆ”μ²œλ“œλ¦½λ‹ˆλ‹€:

 public static PaymentGroupDetailResponse create(String teamName, Integer point, Integer remainPoint,
     User teamLeader, Page<TeamChargeHistoryResponse> historyResponses) {
+    Objects.requireNonNull(teamLeader, "νŒ€μž₯ μ •λ³΄λŠ” ν•„μˆ˜μž…λ‹ˆλ‹€");
+    Objects.requireNonNull(historyResponses, "νžˆμŠ€ν† λ¦¬ μ •λ³΄λŠ” ν•„μˆ˜μž…λ‹ˆλ‹€");
+    
+    if (teamName == null || teamName.trim().isEmpty()) {
+        throw new IllegalArgumentException("νŒ€ 이름은 ν•„μˆ˜μž…λ‹ˆλ‹€");
+    }
+    if (point == null || point < 0) {
+        throw new IllegalArgumentException("μœ νš¨ν•˜μ§€ μ•Šμ€ ν¬μΈνŠΈμž…λ‹ˆλ‹€");
+    }
+    if (remainPoint == null || remainPoint < 0) {
+        throw new IllegalArgumentException("μœ νš¨ν•˜μ§€ μ•Šμ€ μž”μ—¬ ν¬μΈνŠΈμž…λ‹ˆλ‹€");
+    }

-    PaymentGroupDetailResponse paymentGroupDetailResponse = new PaymentGroupDetailResponse();
-    paymentGroupDetailResponse.setTeamName(teamName);
-    paymentGroupDetailResponse.setPoint(point);
-    paymentGroupDetailResponse.setRemainPoint(remainPoint);
-    paymentGroupDetailResponse.setTeamLeaderName(teamLeader.getNickname());
-    paymentGroupDetailResponse.setTeamLeaderPhoneNum(teamLeader.getPhoneNumber());
-    paymentGroupDetailResponse.setHistoryResponses(historyResponses);
-    return paymentGroupDetailResponse;
+    return new PaymentGroupDetailResponse(
+        teamName,
+        point,
+        remainPoint,
+        teamLeader.getNickname(),
+        teamLeader.getPhoneNumber(),
+        historyResponses
+    );
 }

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +16 to +21
private String teamName;
private Integer point;
private Integer remainPoint;
private String teamLeaderName;
private String teamLeaderPhoneNum;
private Page<TeamChargeHistoryResponse> historyResponses;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

ν•„λ“œ μœ νš¨μ„± 검증이 ν•„μš”ν•©λ‹ˆλ‹€

포인트 κ°’κ³Ό ν•„μˆ˜ ν•„λ“œμ— λŒ€ν•œ μœ νš¨μ„± 검증이 μ—†μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 검증 μ–΄λ…Έν…Œμ΄μ…˜μ„ μΆ”κ°€ν•˜λŠ” 것을 μΆ”μ²œλ“œλ¦½λ‹ˆλ‹€:

+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.PositiveOrZero;

 public class PaymentGroupDetailResponse {
-    private String teamName;
-    private Integer point;
-    private Integer remainPoint;
-    private String teamLeaderName;
-    private String teamLeaderPhoneNum;
+    @NotBlank(message = "νŒ€ 이름은 ν•„μˆ˜μž…λ‹ˆλ‹€")
+    private final String teamName;
+    @NotNull(message = "ν¬μΈνŠΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
+    @PositiveOrZero(message = "ν¬μΈνŠΈλŠ” 0 이상이어야 ν•©λ‹ˆλ‹€")
+    private final Integer point;
+    @NotNull(message = "μž”μ—¬ ν¬μΈνŠΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
+    @PositiveOrZero(message = "μž”μ—¬ ν¬μΈνŠΈλŠ” 0 이상이어야 ν•©λ‹ˆλ‹€")
+    private final Integer remainPoint;
+    @NotBlank(message = "νŒ€μž₯ 이름은 ν•„μˆ˜μž…λ‹ˆλ‹€")
+    private final String teamLeaderName;
+    @NotBlank(message = "νŒ€μž₯ μ „ν™”λ²ˆν˜ΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
+    private final String teamLeaderPhoneNum;
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private String teamName;
private Integer point;
private Integer remainPoint;
private String teamLeaderName;
private String teamLeaderPhoneNum;
private Page<TeamChargeHistoryResponse> historyResponses;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.PositiveOrZero;
public class PaymentGroupDetailResponse {
@NotBlank(message = "νŒ€ 이름은 ν•„μˆ˜μž…λ‹ˆλ‹€")
private final String teamName;
@NotNull(message = "ν¬μΈνŠΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
@PositiveOrZero(message = "ν¬μΈνŠΈλŠ” 0 이상이어야 ν•©λ‹ˆλ‹€")
private final Integer point;
@NotNull(message = "μž”μ—¬ ν¬μΈνŠΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
@PositiveOrZero(message = "μž”μ—¬ ν¬μΈνŠΈλŠ” 0 이상이어야 ν•©λ‹ˆλ‹€")
private final Integer remainPoint;
@NotBlank(message = "νŒ€μž₯ 이름은 ν•„μˆ˜μž…λ‹ˆλ‹€")
private final String teamLeaderName;
@NotBlank(message = "νŒ€μž₯ μ „ν™”λ²ˆν˜ΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€")
private final String teamLeaderPhoneNum;
private Page<TeamChargeHistoryResponse> historyResponses;

Comment on lines +51 to +53
public void subRemainPoint(Integer point) {
this.remainPoint -= point;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

μž”μ—¬ ν¬μΈνŠΈκ°€ μŒμˆ˜κ°€ λ˜μ§€ μ•Šλ„λ‘ 검증이 ν•„μš”ν•©λ‹ˆλ‹€.

subRemainPoint λ©”μ„œλ“œμ—μ„œ 차감 ν›„ μž”μ—¬ ν¬μΈνŠΈκ°€ 0보닀 μž‘μ•„μ§€μ§€ μ•Šλ„λ‘ 검증 λ‘œμ§μ„ μΆ”κ°€ν•΄μ•Ό ν•©λ‹ˆλ‹€.

 public void subRemainPoint(Integer point) {
+    if (this.remainPoint < point) {
+        throw new IllegalArgumentException("μž”μ—¬ ν¬μΈνŠΈκ°€ λΆ€μ‘±ν•©λ‹ˆλ‹€. ν˜„μž¬ μž”μ—¬ 포인트: " + this.remainPoint + ", 차감 μš”μ²­ 포인트: " + point);
+    }
     this.remainPoint -= point;
 }
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public void subRemainPoint(Integer point) {
this.remainPoint -= point;
}
public void subRemainPoint(Integer point) {
if (this.remainPoint < point) {
throw new IllegalArgumentException("μž”μ—¬ ν¬μΈνŠΈκ°€ λΆ€μ‘±ν•©λ‹ˆλ‹€. ν˜„μž¬ μž”μ—¬ 포인트: " + this.remainPoint + ", 차감 μš”μ²­ 포인트: " + point);
}
this.remainPoint -= point;
}

Comment on lines +74 to +93
storeService.createStore(customOAuth2User, storeCreateRequestDTO);
return ResponseCustom.OK(Message.builder().message("success").build());
}

@Operation(summary = "κ°€κ²Œ 좔가정보 μ €μž₯", description = "μ˜ˆμ•½ κ°€λŠ₯ μ—¬λΆ€, μ΅œμ†Œ μ„ κ²°μ œ κΈˆμ•‘, μ„ κ²°μ œ μ‚¬μš© 기간을 μ €μž₯ν•©λ‹ˆλ‹€.")
@PostMapping("/create/additionalInfo")
public ResponseCustom<Message> createAdditionalInfo(Authentication authentication, @RequestBody
StoreAdditionalInfoCreateRequestDTO storeAdditionalInfoCreateRequestDTO) {
public ResponseCustom<Message> createAdditionalInfo(Authentication authentication,
@RequestBody StoreAdditionalInfoCreateRequestDTO storeAdditionalInfoCreateRequestDTO) {
CustomOAuthUser customOAuthUser = (CustomOAuthUser)authentication.getPrincipal();
storeService.CreateAdditionalInfo(customOAuthUser, storeAdditionalInfoCreateRequestDTO);
return ResponseCustom.OK(Message.builder()
.message("success")
.build());
storeService.createAdditionalInfo(customOAuthUser, storeAdditionalInfoCreateRequestDTO);
return ResponseCustom.OK(Message.builder().message("success").build());
}

@Operation(summary = "κ°€κ²Œ 정보 μˆ˜μ •", description = "κ°€κ²Œ 정보λ₯Ό μˆ˜μ •ν•©λ‹ˆλ‹€.")
@PatchMapping("/{storeId}/update")
public ResponseCustom<Message> updateStore(Authentication authentication, @PathVariable Long storeId, @RequestBody
StoreUpdateRequestDTO storeUpdateRequestDTO) {
public ResponseCustom<Message> updateStore(Authentication authentication, @PathVariable Long storeId,
@RequestBody StoreUpdateRequestDTO storeUpdateRequestDTO) {
CustomOAuthUser principal = (CustomOAuthUser)authentication.getPrincipal();
storeService.updateStore(principal, storeId, storeUpdateRequestDTO);
return ResponseCustom.OK(Message.builder()
.message("success")
.build());
return ResponseCustom.OK(Message.builder().message("success").build());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

인증 처리 λ°©μ‹μ˜ 톡일화가 ν•„μš”ν•©λ‹ˆλ‹€.

μŠ€ν† μ–΄ 관리 μ—”λ“œν¬μΈνŠΈλ“€μ—μ„œ CustomOAuthUser μΊμŠ€νŒ… 방식이 반볡되고 μžˆμŠ΅λ‹ˆλ‹€. AuthenticationParserλ₯Ό ν™œμš©ν•˜μ—¬ μ½”λ“œ 쀑볡을 μ œκ±°ν•˜κ³  μΌκ΄€λœ λ°©μ‹μœΌλ‘œ μ²˜λ¦¬ν•˜λŠ” 것이 μ’‹κ² μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

 public ResponseCustom<Message> createStore(Authentication authentication,
   @RequestBody StoreCreateRequestDTO storeCreateRequestDTO) {
-  CustomOAuthUser customOAuth2User = (CustomOAuthUser)authentication.getPrincipal();
-  storeService.createStore(customOAuth2User, storeCreateRequestDTO);
+  storeService.createStore(AuthenticationParser.parseUserId(authentication), storeCreateRequestDTO);
   return ResponseCustom.OK(Message.builder().message("success").build());
 }

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +47 to +66
Authentication authentication,
@RequestParam(required = false, defaultValue = "3") Integer searchRadius,
@RequestParam(required = false, defaultValue = "ALL") Category category,
@ModelAttribute StoreSearchCondition storeSearchCondition,
Pageable pageable
) {
return ResponseCustom.OK(storeService.searchByCategory(authentication, searchRadius, category, storeSearchCondition, pageable));
return ResponseCustom.OK(
storeService.searchByCategory(authentication, searchRadius, category, storeSearchCondition, pageable));
}

@Operation(summary = "맀μž₯ μ°ΎκΈ°(검색)", description = "검색어와 맀μž₯ μœ ν˜•μ— λ§žλŠ” 맀μž₯을 κ²€μƒ‰ν•©λ‹ˆλ‹€.")
@GetMapping("/search")
public ResponseCustom<Page<SearchStoresResponse>> searchStores(
Authentication authentication,
@RequestParam(required = false, defaultValue = "") String keyword,
@ModelAttribute StoreSearchConditionWithType storeSearchConditionWithType,
Pageable pageable
Authentication authentication,
@RequestParam(required = false, defaultValue = "") String keyword,
@ModelAttribute StoreSearchConditionWithType storeSearchConditionWithType,
Pageable pageable
) {
return ResponseCustom.OK(storeService.searchStores(authentication, keyword, storeSearchConditionWithType, pageable));
return ResponseCustom.OK(
storeService.searchStores(authentication, keyword, storeSearchConditionWithType, pageable));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

인증 처리 둜직 κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

검색 μ—”λ“œν¬μΈνŠΈλ“€μ˜ 인증 μ²˜λ¦¬κ°€ 일관성이 μ—†μŠ΅λ‹ˆλ‹€. AuthenticationParserλ₯Ό μ‚¬μš©ν•˜μ—¬ 인증 처리λ₯Ό ν†΅μΌν•˜λŠ” 것이 μ’‹κ² μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

 public ResponseCustom<Page<SearchStoresResponse>> searchByCategory(
   Authentication authentication,
   @RequestParam(required = false, defaultValue = "3") Integer searchRadius,
   @RequestParam(required = false, defaultValue = "ALL") Category category,
   @ModelAttribute StoreSearchCondition storeSearchCondition,
   Pageable pageable
 ) {
   return ResponseCustom.OK(
-    storeService.searchByCategory(authentication, searchRadius, category, storeSearchCondition, pageable));
+    storeService.searchByCategory(AuthenticationParser.parseUserId(authentication), searchRadius, category, storeSearchCondition, pageable));
 }

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +191 to +193
User user = userRepository.findByProviderId(userId)
.orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION));

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

μ˜ˆμ™Έ 처리 및 μ—λŸ¬ μ½”λ“œμ˜ λͺ…확성을 κ°œμ„ ν•΄μ£Όμ„Έμš”.

ν˜„μž¬ μ—¬λŸ¬ κ³³μ—μ„œ DefaultNullPointerException을 μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. ν•˜μ§€λ§Œ 이 μ˜ˆμ™ΈλŠ” μ‹€μ œ 널 포인터 μ˜ˆμ™Έμ™€ ν˜Όλ™λ  수 μžˆμœΌλ―€λ‘œ, 보닀 μ˜λ―Έκ°€ λͺ…ν™•ν•œ μ»€μŠ€ν…€ μ˜ˆμ™Έλ₯Ό μƒμ„±ν•˜μ—¬ μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. λ˜ν•œ ErrorCode.INVALID_AUTHENTICATIONκ³Ό ErrorCode.INVALID_PARAMETERλ₯Ό 상황에 맞게 μΌκ΄€λ˜κ²Œ μ‚¬μš©ν•˜κ³  μžˆλŠ”μ§€ 확인이 ν•„μš”ν•©λ‹ˆλ‹€.

Also applies to: 195-199, 201-202, 204-205, 207-208

Comment on lines +156 to +167
public Page<StoreTeamResponseDTO> getPaymentGroup(String userId, Pageable pageable) {
User user = userRepository.findByProviderId(userId)
.orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION));

Owner owner = ownerRepository.findByUser(user)
.orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION));

Store store = storeRepository.findByOwner(owner)
.orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION));

return storeTeamRepository.findAllByStore(store, pageable);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

μ—λŸ¬ 처리 둜직의 톡일성을 ν™•μΈν•΄μ£Όμ„Έμš”.

getPaymentGroup와 getPaymentGroupDetail λ©”μ„œλ“œμ—μ„œ μ—λŸ¬ λ°œμƒ μ‹œ λ™μΌν•œ μ—λŸ¬ μ½”λ“œμ™€ μ˜ˆμ™Έλ₯Ό λ˜μ§€κ³  μžˆμŠ΅λ‹ˆλ‹€. μ—λŸ¬ 원인에 따라 μ μ ˆν•œ μ—λŸ¬ μ½”λ“œλ₯Ό μ‚¬μš©ν•˜κ³ , ν΄λΌμ΄μ–ΈνŠΈκ°€ 원인을 νŒŒμ•…ν•  수 μžˆλ„λ‘ μƒμ„Έν•œ μ˜ˆμ™Έ 처리λ₯Ό ꢌμž₯ν•©λ‹ˆλ‹€.

Also applies to: 190-213

@HyunWoo9930 HyunWoo9930 merged commit 26b007d into main Nov 19, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant